package com.pizza.abstrait;

import java.io.Serializable;

import javax.faces.component.UICommand;
import javax.faces.component.UIOutput;

import com.pizza.model.Diametre;
import com.pizza.model.Pate;
import com.pizza.model.Pizza;

/**
 * Class AbstractCommandeLignePizza
 *
 */
public class AbstractCommandeLignePizza implements Serializable {

	protected AbstractPizza pizza;

	protected Pate pate;

	protected Diametre diametre;

	protected int quantite;

	protected float prixUnitaire;
	
	protected float prix;
	
	protected AbstractCommande commande;
	
	public Diametre getDiametre() {
		return diametre;
	}

	public void setDiametre(Diametre diametre) {
		this.diametre = diametre;
	}

	public Pate getPate() {
		return pate;
	}

	public void setPate(Pate pate) {
		this.pate = pate;
	}

	public AbstractPizza getPizza() {
		return pizza;
	}

	public void setPizza(AbstractPizza pizza) {
		this.pizza = pizza;
	}

	public float getPrix() {
		return prix;
	}

	public void setPrix(float prix) {
		this.prix = prix;
	}

	public int getQuantite() {
		return quantite;
	}

	public void setQuantite(int quantite) {
		this.quantite = quantite;
		this.prix = this.getPrixUnitaire() * this.quantite;
	}

	public float getPrixUnitaire() {
		return pizza.getPrix(diametre);
	}

	public void setPrixUnitaire(float prixUnitaire) {
		this.prixUnitaire = prixUnitaire;
	}

	public AbstractCommande getCommande() {
		return commande;
	}

	public void setCommande(AbstractCommande commande) {
		this.commande = commande;
	}
	
	public void suppressionCommande() {
		getCommande().removePizza(this);
	}

	
}
